using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
namespace HKB.Common
{
	public class Util
	{
		public static void AddHeader(string AddTitle, string AddKeyContent, string AddDescriptionContent)
		{
			Page page = (Page)HttpContext.Current.PreviousHandler;
			bool flag = false;
			if (page.Header != null && page.Header.Controls.Count < 4)
			{
				for (int i = 0; i < page.Header.Controls.Count; i++)
				{
					if (page.Header.Controls[i].ToString().Contains("HtmlMeta"))
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					page.Title = AddTitle;
					page.MetaKeywords = AddKeyContent;
					page.MetaDescription = AddDescriptionContent;
				}
			}
		}
		public static void AddStyle(string LinkHref)
		{
			Page page = (Page)HttpContext.Current.Handler;
			HtmlLink htmlLink = new HtmlLink();
			htmlLink.Attributes["rel"] = "stylesheet";
			htmlLink.Attributes["type"] = "text/css";
			htmlLink.Href = LinkHref;
			page.Header.Controls.Add(htmlLink);
		}
	}
}
